<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <button id="=btn">单击</button>
</body>

</html>
<script>
  //获取事件源
  var button = document.getElementById('btn');
  //为获取的元素注册鼠标单击事件
  button.onclick = function () {
    alert('hello');
  }
</script>